package cn.juque.datapipeline.service.impl;

import cn.juque.common.base.PageInfo;
import cn.juque.datapipeline.domain.TaskExecuteInfoDO;
import cn.juque.datapipeline.domain.TaskExecuteInfoSearchParamDO;
import cn.juque.datapipeline.mapper.TaskExecuteInfoMapper;
import cn.juque.datapipeline.service.ITaskExecuteInfoService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author JUQUE
 * @version 1.0.0
 * <ul>
 *  <li>simple-generator</li>
 *  <li>任务执行信息</li>
 * </ul>
 * {@code @date} 2023-04-03 18:33:19
 **/
@Service("taskExecuteInfoService")
public class TaskExecuteInfoServiceImpl implements ITaskExecuteInfoService {

    @Resource
    private TaskExecuteInfoMapper taskExecuteInfoMapper;

    /**
     * 分页查询
     *
     * @param pageInfo        pageInfo
     * @param taskExecuteInfo taskExecuteInfo
     * @return DataGrid
     */
    @Override
    public List<TaskExecuteInfoDO> listExecuteInfoWithPage(PageInfo pageInfo, TaskExecuteInfoSearchParamDO taskExecuteInfo) {
        Page<TaskExecuteInfoDO> page = new Page<>(pageInfo.getPage(), pageInfo.getLimit());
        List<TaskExecuteInfoDO> list = this.taskExecuteInfoMapper.queryExecuteInfoList(page, taskExecuteInfo);
        pageInfo.setTotal(page.getTotal());
        return list;
    }

    /**
     * 查询
     *
     * @param taskExecuteInfo taskExecuteInfo
     * @return List
     */
    @Override
    public List<TaskExecuteInfoDO> listExecuteInfoWithoutPage(TaskExecuteInfoSearchParamDO taskExecuteInfo) {
        return this.taskExecuteInfoMapper.queryExecuteInfoList(taskExecuteInfo);
    }
}
